package com.by.toolkitspring.dynamictp;

import com.by.toolkit.platform.ByContext;
import lombok.extern.slf4j.Slf4j;
import org.dromara.dynamictp.core.support.task.wrapper.TaskWrapper;

import java.util.Map;

@Slf4j
public class ByDynamicTpTaskWrapper implements TaskWrapper {

    @Override
    public String name() {
        return "byTask";
    }

    @Override
    public Runnable wrap(Runnable runnable) {
        Map<String, String> parentContext = ByContext.getAll();
        //log.info("[ByDynamicTpTaskWrapper][wrap] parentContext:[{}]", parentContext);
        return new ByDynaimcTpRunnable(runnable, parentContext);
    }
}
